import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code3_2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] c = in.next().toCharArray();

        StringBuffer st = new StringBuffer();
        for(int i=0;i<c.length;i++) {
            char ch = c[i];
            if(st.length()>0 && ch == st.charAt(st.length()-1)) {
                st.deleteCharAt(st.length()-1);
            } else {
                st.append(ch);
            }
        }
        System.out.println(st.length()==0?0:st.toString());
    }
}